<%@ page import="org.springside.core.Constants"%>
<%@ page import="org.springside.modules.security.domain.UserSession"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<fmt:message key="home_portal_label100" var="home_portal_label100"/>
<fmt:message key="home_portal_label101" var="home_portal_label101"/>
<fmt:message key="home_portal_label102" var="home_portal_label102"/>
<fmt:message key="home_portal_label103" var="home_portal_label103"/>
<fmt:message key="home_portal_label104" var="home_portal_label104"/>
<fmt:message key="home_portal_label105" var="home_portal_label105"/>
<fmt:message key="home_portal_label106" var="home_portal_label106"/>
<fmt:message key="home_portal_label107" var="home_portal_label107"/>
<fmt:message key="home_portal_label108" var="home_portal_label108"/>
<fmt:message key="home_portal_label109" var="home_portal_label109"/>
<fmt:message key="home_portal_label110" var="home_portal_label110"/>
<fmt:message key="home_portal_label111" var="home_portal_label111"/>
<fmt:message key="home_portal_label112" var="home_portal_label112"/>
<fmt:message key="home_portal_label113" var="home_portal_label113"/>
<fmt:message key="home_portal_label114" var="home_portal_label114"/>
<fmt:message key="home_portal_label115" var="home_portal_label115"/>
<fmt:message key="home_portal_label116" var="home_portal_label116"/>
<fmt:message key="calendar_portal1_label15" var="calendar_portal1_label15"/>
<fmt:message key="calendar_portal1_label16" var="calendar_portal1_label16"/>
<fmt:message key="calendar_portal1_label17" var="calendar_portal1_label17"/>
<fmt:message key="home_portal_label122" var="home_portal_label122"/>
<fmt:message key="home_portal_label123" var="home_portal_label123"/>
<fmt:message key="home_portal_label124" var="home_portal_label124"/>
<fmt:message key="home_portal_label125" var="home_portal_label125"/>
<fmt:message key="home_portal_label126" var="home_portal_label126"/>
<fmt:message key="home_portal_label127" var="home_portal_label127"/>
<fmt:message key="calendar_portal1_label1" var="calendar_portal1_label1"/>
<fmt:message key="calendar_portal1_label20" var="calendar_portal1_label20"/>
<fmt:message key="calendar_portal1_label8" var="calendar_portal1_label8"/>

<fmt:message key="calendar_portal1_label21" var="calendar_portal1_label21"/>
<fmt:message key="calendar_portal1_label22" var="calendar_portal1_label22"/>
<fmt:message key="calendar_portal1_label23" var="calendar_portal1_label23"/>
<fmt:message key="calendar_portal1_label24" var="calendar_portal1_label24"/>

<style>
body{background-color: #fff;}
<!--
.tbl_calendar{
	text-align:center;
	position:relative;
	border:0px;
	line-height:18px;
	background-repeat:no-repeat;
	background-position:center;
	}
}
-->
</style>
<script type="text/javascript">
<!--

function selectYear()
{
	var year =	document.all.selectY.value;
    var m =	document.all.selectM.value;
    //var url="<c:url value='/modules/portal/portalService.do?method=index&toPage=${param.toPage}&year="+year+"&month="+m+"&day=${day}'/>";
    var url = "<c:url value='/modules/home/portal.do?method=calendarPortal2&openwin=true&toPage=${param.toPage}&year="+year+"&month="+m+"&day=${day}&portletNewId=${param.portletNewId}'/>";
	 document.location.href=url;
}

//-->
</script>
<%
String today []= new String[]{"日","一","二","三","四","五","六"};
int index=new Integer(request.getAttribute("week").toString());
String week_=today[index-1];
//add by liuzhengwei 2011-03-18 start,解决在portlet框架中获取不到cookie值问题，问题单：BT523717
UserSession user = (UserSession) request.getSession().getAttribute(Constants.USER_IN_SESSION);
String displayValue=(String)request.getSession().getAttribute("display_"+user.getId());
String imagStr="date_arrowhead_5.gif";
if("none".equals(displayValue))
{
	imagStr="date_arrowhead_4.gif";
}
//add by liuzhengwei 2011-03-18 end
 %>
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" id="zhouyq">
<tr>
              <td height="32"><table width="100%" height="32" border="0"  cellpadding="0"
		cellspacing="0" >
                  <tr>
                  <%--modify by yuan_zeng 2012-1-30  --%>
<!--                    <td width="6" background="../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/portlet/calendar_top_left.png">&nbsp;</td>-->
<!--                    <td background="../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/portlet/calendar_top_bosom.png">-->
					
					<td>&nbsp;</td>
                    <td>
					 
					  <table border="0">
					  	<tr>
					  		<td>
					  			<select id="selectY" name="selectY" onchange="selectYear();" size="1">
					                <option value="2008" ${year=='2008'?'selected="selected" ':''}>2008</option>
					                <option value="2009" ${year=='2009'?'selected="selected" ':''}>2009</option>
					                <option value="2010" ${year=='2010'?'selected="selected" ':''}>2010</option>
					                <option value="2011" ${year=='2011'?'selected="selected" ':''}>2011</option>
					                <option value="2012" ${year=='2012'?'selected="selected" ':''}>2012</option>
					                <option value="2013" ${year=='2013'?'selected="selected" ':''}>2013</option>
					                <option value="2014" ${year=='2014'?'selected="selected" ':''}>2014</option>
					                <option value="2015" ${year=='2015'?'selected="selected" ':''}>2015</option>
					                <option value="2016" ${year=='2016'?'selected="selected" ':''}>2016</option>
					                <option value="2017" ${year=='2017'?'selected="selected" ':''}>2017</option>
				                </select>
				               &nbsp;
					  		</td>
					  		<td>
					  			<select id="selectM"  onchange="selectYear();"  name="selectM" size="1">
									  <option value="1" ${month=='1'?'selected="selected" ':''}>${home_portal_label110}${home_portal_label101}</option>
									  <option value="2" ${month=='2'?'selected="selected" ':''}>${home_portal_label111}${home_portal_label101}</option>
									  <option value="3" ${month=='3'?'selected="selected" ':''}>${home_portal_label112}${home_portal_label101}</option>
									  <option value="4" ${month=='4'?'selected="selected" ':''}>${home_portal_label113}${home_portal_label101}</option>
									  <option value="5" ${month=='5'?'selected="selected" ':''}>${home_portal_label114}${home_portal_label101}</option>
									  <option value="6" ${month=='6'?'selected="selected" ':''}>${home_portal_label115}${home_portal_label101}</option>
									  <option value="7" ${month=='7'?'selected="selected" ':''}>${home_portal_label122}${home_portal_label101}</option>
									  <option value="8" ${month=='8'?'selected="selected" ':''}>${home_portal_label123}${home_portal_label101}</option>
									  <option value="9" ${month=='9'?'selected="selected" ':''}>${home_portal_label124}${home_portal_label101}</option>
									  <option value="10" ${month=='10'?'selected="selected" ':''}>${home_portal_label125}${home_portal_label101}</option>
									  <option value="11" ${month=='11'?'selected="selected" ':''}>${home_portal_label126}${home_portal_label101}</option>
									  <option value="12" ${month=='12'?'selected="selected" ':''}>${home_portal_label127}${home_portal_label101}</option>
			                  </select>
			                  
					  		</td>
					  		<td>
					  		 <span  style="color: #737373;"> ${home_portal_label103}<font  id='week'><%=week_ %></font>   </span>
					  		</td>
					  	</tr>
					  </table>
				  
				 
					</td>
					<%--modify by yuan_zeng 2012-1-30  --%>
<!--                       <td width="6" background="../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/portlet/calendar_top_right.png">&nbsp;</td>-->
<!--                    <td width="6">&nbsp;</td>   -->
                  </tr>
              </table></td>
            </tr>
            
            
            
            
            
            <!-- 我的任务开始 -->
            <tr>
            	<td valign="top" class="content_border_calendar" style="padding-left:5px">
            		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            			<tr align="left">
            				<td width="86">
            					<img border="0" src="../../themes/${sessionScope.loginUser.theme}/home/images/date_pic_meeting.png" width="67" height="68">
            				</td>
            				<td valign="middle">
            					<table width="100%" border="0" cellspacing="0" cellpadding="0">
            						<%
	            						Integer taskTadayCount = (Integer)request.getAttribute("taskTadayCount"); 
	            					  	Integer meetingTadayCount = (Integer)request.getAttribute("meetingTadayCount");
	            					  	if(meetingTadayCount > 0){
	            					%>
            						<tr height="26">
            							<td>
            								${calendar_portal1_label22}&nbsp;
            								<a href="javascript:void(0)" onClick='mainJump("/modules/meeting/meetings.do?method=onMeetingInfoList&ec_s_startday=desc&show=waitmeeting")' style="text-decoration:underline;">
            									${meetingTadayCount}
            								</a>&nbsp;
            								${calendar_portal1_label24}
            							</td>
            						</tr>
            						<%} if(taskTadayCount > 0){ %>
            						<tr height="26">
            							<td>
            								${calendar_portal1_label23}&nbsp;
            								<a href="javascript:void(0)" onClick='mainJump("/modules/task/task.do?method=list&type=mytask")' style="text-decoration:underline;">
            									${taskTadayCount}
            								</a>&nbsp;
            								${calendar_portal1_label24}
            							</td>
            						</tr>
            						<%} if(meetingTadayCount == 0 && taskTadayCount == 0) { %>
            						<tr height="26">
            							<td>
            								${calendar_portal1_label21}
            							</td>
            						</tr>
            						<%} %>
            					</table>
            				</td>
            			</tr>
            		</table>
              	
              
              <%-- modify by yuan_zeng 2012-5-15
              <div id="p_calendar"  style="display: <%=displayValue%>">
              <table  width="100%"    border="0" cellspacing="0" cellpadding="0">
              <tbody>
              <c:if test="${fn:length(calendarLists)==0}">
			  <tr>
                  <td width="67" height="84" style="padding-left:20px"><img src="../../themes/${sessionScope.loginUser.theme}/home/images/date_pic_meeting.png" width="67" height="68"></td>
                  <td align="left" style="padding-left:10px">${calendar_portal1_label20}</td>
				</tr>
              </c:if>
              <!--日程小于4条 不滚动 -->

              <c:if test="${fn:length(calendarLists)<=4 && fn:length(calendarLists)!=0}">
		            <c:forEach items="${calendarLists}" var="task" varStatus="status">
					<tr>
					<td height="21">
					<c:if test="${task.source != 'teamwork'}"> <!-- 非来自于团队协作 -->
<img src="../../themes/portlet/listLogo/WorkflowSequence.gif" align="absmiddle"/>
<c:if test="${task.type==0}">
<a  href="javascript:void(0);" title="${task.content}" onClick='mainJump("/modules/task/task.do?method=edit&id=${task.id}&type=alltask","<%=Constants.USER_THEME_FRAME %>")'>
</c:if>
<c:if test="${task.type==1}">
<a  href="javascript:void(0);" title="${task.content}"  onClick='mainJump("/modules/meeting/meetings.do?method=show&meetingId=${task.pid}&op=waitJoin&show=waitmeeting")'>
</c:if>	
						<c:if test="${fn:length(task.content)>15}">
		                	${fn:substring(task.content,0,15)}....
		                	 </a>
		                </c:if>
		                <c:if test="${fn:length(task.content)<=15}">
		                	${task.content}
			                  </a>
			                     </c:if>	                     
		                <c:if test="${status.last!=true}">
		                <br>
		                </c:if>
		                </c:if> <!-- End -->
						<c:if test="${task.source=='teamwork'}"> <!-- 来自于团队协作 -->
						    <img src="../../themes/portlet/listLogo/WorkflowSequence.gif" align="absmiddle"/>
                               <a  href="javascript:void(0);" title="${task.content}" onClick='mainJump("/modules/teamwork/teamworkReport.do?method=singleReport&id=${task.teamworkTask.id}","<%=Constants.USER_THEME_FRAME %>")'>
						        <c:if test="${fn:length(task.content)>15}">
		                	       ${fn:substring(task.content,0,15)}....
		                	   </a>
		                        </c:if>
		                        <c:if test="${fn:length(task.content)<=15}">
		                	      ${task.content}
			                   </a>
			                     </c:if>
		                         <c:if test="${status.last!=true}">
		                          <br>
		                         </c:if>
						</c:if>  <!-- End -->
						</td>
						 </tr>
		                 </c:forEach>
        <c:if test="${fn:length(calendarLists)<1}"> <tr>  <td height="21">&nbsp;  </td>   </tr></c:if>
        <c:if test="${fn:length(calendarLists)<2}"> <tr>  <td height="21">&nbsp;  </td>  </tr></c:if>
        <c:if test="${fn:length(calendarLists)<3}"> <tr>  <td height="21">&nbsp;  </td>  </tr></c:if>
        <c:if test="${fn:length(calendarLists)<4}"> <tr>  <td height="21">&nbsp;  </td>  </tr></c:if>
		      </c:if>

		      <!--日程大于4条，要进行滚动 -->
              <c:if test="${fn:length(calendarLists)>4}">
		                 <div id="calendarDiv" style="overflow:hidden;height:84px;width:100%;">
							<div id="calendarDiv1" style="width:100%;"> 
								<c:forEach items="${calendarLists}" var="task" varStatus="status">
								   <p style="line-height:25px;padding:2	0px; margin:0px;">
						           <img src="../../themes/portlet/listLogo/WorkflowSequence.gif" align="absmiddle"/>
						           <c:if test="${task.type==0}">
						                  <a  title="${task.content}" href="javascript:void(0);" onClick='mainJump("/modules/task/task.do?method=edit&id=${task.id}&type=alltask","<%=Constants.USER_THEME_FRAME %>")'>
								   </c:if>
								   <c:if test="${task.type==1}">
							   			  <a  href="javascript:void(0);" title="${task.content}"  onClick='mainJump("/modules/meeting/meetings.do?method=show&meetingId=${task.pid}&op=waitJoin&show=waitmeeting")'>
								   </c:if>
						            <c:if test="${fn:length(task.content)>15}">
					                	${fn:substring(task.content,0,15)}....
					                </c:if>
		
					                <c:if test="${fn:length(task.content)<=15}">
					                	${task.content}
					                </c:if>
					                  </a>
									</p>
									
							<c:if test="${task.source!='teamwork'}"> <!-- 不来自于团队协作 add by shiwu_bin  START-->
			           
				                  <a  title="${task.content}" href="javascript:void(0);" onClick='mainJump("/modules/task/task.do?method=edit&id=${task.id}&type=alltask","<%=Constants.USER_THEME_FRAME %>")'>

				            <c:if test="${fn:length(task.content)>15}">
			                	${fn:substring(task.content,0,15)}....
			                </c:if>

			                <c:if test="${fn:length(task.content)<=15}">
			                	${task.content}
			                </c:if>
				                  </a>
				          </c:if>  <!-- END -->
				          <c:if test="${task.source=='teamwork'}"> <!-- 来自于团队协作 START -->
				             <img src="../../themes/portlet/listLogo/WorkflowSequence.gif" align="absmiddle"/>
				               <a  title="${task.content}" href="javascript:void(0);" onClick='mainJump("/modules/teamwork/teamworkReport.do?method=singleReport&id=${task.teamworkTask.id}","<%=Constants.USER_THEME_FRAME %>")'>
				                 <c:if test="${fn:length(task.content)>15}">
			                	    ${fn:substring(task.content,0,15)}....
			                     </c:if>
			                     <c:if test="${fn:length(task.content)<=15}">
			                	    ${task.content}
			                     </c:if>
				               </a>
				          </c:if>     <!-- END  -->		
				                 </c:forEach>
							</div>
							<div id="calendarDiv2" style="width:100%;"></div>
						</div>
						<script type="text/javascript">
							var calendarDiv = document.getElementById("calendarDiv");
							var calendarDiv1 = document.getElementById("calendarDiv1");
							var calendarDiv2 = document.getElementById("calendarDiv2");
							calendarDiv2.innerHTML = calendarDiv1.innerHTML;
							function imitate_marquee(){
								if(calendarDiv2.offsetTop<=calendarDiv.scrollTop){
								   calendarDiv.scrollTop -= calendarDiv1.offsetHeight;
								}else{
								   calendarDiv.scrollTop++;
								}
							}
							
							var calendarDivTimes = setInterval(imitate_marquee,80); 
							
							calendarDiv.onmouseover = function(){
								clearInterval(calendarDivTimes);
							}
							
							calendarDiv.onmouseout = function(){
								calendarDivTimes = setInterval(imitate_marquee,80);
							}
						</script>

              </c:if>

		       </tbody>
              </table>
              </div>
<table  width="100%"   class="tbl_yellow_line2">
<tr>
		      <tr align="right">  <td align="right" style="background: "><img id="p_calendar_img" onclick="showOrHideDiv('p_calendar','date_arrowhead_5.gif','date_arrowhead_4.gif');" align="right" src="../../themes/${sessionScope.loginUser.theme}/home/images/<%=imagStr%>"> </td></tr>
</tr>
</table>
				--%>
              </td>
            </tr>
            
            
            
            
            <!-- 我的日历开始 -->
            <tr>
              <td class="content_border_list" >
              <table width="100%" cellpadding="0" cellspacing="0" border="0" style="line-height:39px;margin-bottom:10px">


								<%int i = 0;%>

												<TR>
												<TD  align="center">
														${home_portal_label102}
													</TD>
													<TD align="center"   >
														${home_portal_label110}
													</TD>
													<TD align="center"   >
														${home_portal_label111}
													</TD>
													<TD align="center"   >
														${home_portal_label112}
													</TD>
													<TD align="center"   >
														${home_portal_label113}
													</TD>
													<TD align="center"   >
														${home_portal_label114}
													</TD>
													<TD align="center"   >
														${home_portal_label115}
													</TD>
												</TR>
												<TR>
												<c:set var="i2" value="7"></c:set>
													<c:forEach var="calendars" items="${calendarsPortal}">
														<TD  class="tbl_calendar"  <c:if test="${calendars.titleCount>0}"> background="../../themes/${sessionScope.loginUser.theme}/home/images/ico_circularity.gif"</c:if>>
															<A  href="javascript:void(0);"
																onClick='mainJump("/modules/calendar2/calendar2.do?method=day&year=${calendars.year}&month=${calendars.month}&day=${calendars.day}&userid=","<%=Constants.USER_THEME_FRAME %>")'
																<c:choose>
																<c:when test="${fn:contains(calendars.titleCount,'0')}">
															 	title="${calendar_portal1_label15}"
																</c:when>
																<c:otherwise>
																title="${calendar_portal1_label16}${calendars.titleCount}${calendar_portal1_label17}${calendars.title}"
																</c:otherwise>
																</c:choose>>

																<c:choose>
																	<c:when test="${fn:contains(calendars.selectDay,'1')}">
																		<font style=" font-size:9pt;color:#E67001";>${calendars.name}</font>
																		<script type="text/javascript">
																		var today = new Array("${home_portal_label110}","${home_portal_label111}","${home_portal_label112}","${home_portal_label113}","${home_portal_label114}","${home_portal_label115}","${home_portal_label102}");
     																	 document.all.week.innerHTML = today[${i2-1}];

																		</script>
																	</c:when>
																	<c:otherwise>

																		<c:choose>
																			<c:when test="${i2=='6' || i2=='7'}">

																				 <c:choose>
																						<c:when test="${fn:contains(calendars.flag,'P') || fn:contains(calendars.flag,'N')}">
																						<font color="#b0b0b0">${calendars.name}</font>
																						</c:when>
																					<c:otherwise>
																						 <font color="red">${calendars.name}</font>
																					</c:otherwise>
																				</c:choose>
																			</c:when>
																			<c:otherwise>
																				 <c:choose>
																						<c:when test="${fn:contains(calendars.flag,'P') || fn:contains(calendars.flag,'N')}">
																						<font color="#b0b0b0">${calendars.name}</font>
																						</c:when>
																					<c:otherwise>
																						<font color="#000">${calendars.name}</font>
																					</c:otherwise>
																				</c:choose>

																			</c:otherwise>
																		</c:choose>

				  													</c:otherwise>
																</c:choose>

															</A>
														</TD>

														<c:choose>
															<c:when test="${i2==7}">
																<c:set var="i2" value="1"></c:set>
															</c:when>
															<c:otherwise>
																<c:set var="i2" value="${i2+1}"></c:set>
															</c:otherwise>
														</c:choose>


														<%i++;if (i % 7 == 0) {	%>
														<tr></tr>
														<%}	%>
													</c:forEach>
												</TR>



              </table>

               <!-- 我的日历结束 -->


              </td>
            </tr>
            <script type="text/javascript">
<!--
	var today = new Array("${home_portal_label109}","${home_portal_label110}","${home_portal_label111}","${home_portal_label112}","${home_portal_label113}","${home_portal_label114}","${home_portal_label115}");
	document.all.week.innerHTML= today[${week-1}];
//-->
</script>
<%-- 
<c:if test="${fn:length(calendarLists)>4}">
       <!-- 我的日程滚动效果脚本 -->
<script language="JavaScript">

	marqueesHeight=84;
	stopscroll=false;
	with(marquees){
		style.width=0;
		style.height=marqueesHeight;
		style.overflowX="visible";
		style.overflowY="hidden";
		noWrap=true;
		onmouseover=new Function("stopscroll=true");
		onmouseout=new Function("stopscroll=false");
	}
	document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');
	preTop=0; currentTop=0;
	
	function init(){
		templayer.innerHTML="";
		while(templayer.offsetHeight<marqueesHeight){
		templayer.innerHTML+=marquees.innerHTML;
		}
		marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
		setInterval("scrollUp()",70);
	}
	document.body.onload=init;
	function scrollUp(){
		if(stopscroll==true) return;
		preTop=marquees.scrollTop;
		marquees.scrollTop+=1;
		if(preTop==marquees.scrollTop){
		marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
		marquees.scrollTop+=1;
	}
}
</script>
</c:if>
--%>
<script type="text/javascript">
  function showOrHideDiv(obj,s_img,b_img)
   {
   		var _div = document.getElementById(obj);
   		if(_div.style.display=='none')
   			{
   				 showSubPanel(obj);
   				 document.getElementById(obj+"_img").src="../../themes/${sessionScope.loginUser.theme}/home/images/"+s_img;
 	  		}else
 	  		{
 	  		
 	  			  hideSubPanel(obj);
 	  			 document.getElementById(obj+"_img").src="../../themes/${sessionScope.loginUser.theme}/home/images/"+b_img;
 	  		}
 	  	if(window.top.parent.reinitIframe != undefined){	
			window.top.parent.reinitIframe("tabIFrame_portlet${param.portletNewId}");
		}
   }


</script>
<div id="templayer" style="position:absolute;z-index:1;visibility:hidden;overflow:hidden"></div>
<input type="hidden" id="calendarListSize" value="${fn:length(calendarLists)}">
</table>
